home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
GRAPHICS
/
TS32
/
GRAFIX.INT
< prev
next >
Wrap
Text File
|
1996-03-21
|
4KB
|
114 lines
unit Grafix;
(*********************************************
Custom graphics classes and drawing routines.
*********************************************)
interface
uses
Windows, SysUtils, Classes;
const
PI = 3.14159265359;
type
TDIBOrientation = ( orAuto, orTopDown, orBottomUp );
TDegree = 0..360;
TVertex = class( TObject )
private
FX, FY: integer;
protected
function GetPoint: TPoint;
public
property X: integer read FX write FX;
property Y: integer read FY write FY;
constructor CreateVertex( nX, nY: integer );
property Point: TPoint read GetPoint;
end;
TRectangle = class( TObject )
private
FLeft: integer;
FRight: integer;
FTop: integer;
FBottom: integer;
protected
function GetHeight: integer;
function GetRect: TRect;
function GetWidth: integer;
public
constructor CreateRectangle( l, t, r, b: integer );
constructor CreateFromRect( rect: TRect );
property Height: integer read GetHeight;
property Left: integer read FLeft write FLeft;
property Top: integer read FTop write FTop;
property Right: integer read FRight write FRight;
property Bottom: integer read FBottom write FBottom;
property Rect: TRect read GetRect;
property Width: integer read GetWidth;
end;
TPolygon = class( TObject )
private
FClosed: boolean;
protected
lstVertices: TList;
function GetNum: integer;
function GetVertex( n: integer ): TVertex;
public
property Closed: boolean read FClosed write FClosed;
constructor Create;
destructor Destroy; override;
procedure Assign( p: TPolygon );
procedure AddVertex( v: TVertex );
procedure Rotate( Degrees: TDegree );
property VertexCount: integer read GetNum;
property Vertex[n: integer]: TVertex read GetVertex;
end;
TFillElement = class( TObject )
private
protected
public
myLx, myLy: integer;
dadLx, dadLy: integer;
myY: integer;
myDirection: integer;
end;
(***************************************************
Graphics routines
***************************************************)
function ClipLine( var x1, y1, x2, y2: integer; const rect: TRect ): boolean;
procedure CopyBlock( pSrc, pDest: pointer; nSrcWidth, nSrcHeight: integer;
nSrcBlockWidth, nSrcBlockHeight: integer; nSrcX, nSrcY: integer; nDestWidth,
nDestHeight: integer; nDestX, nDestY: integer; nTransColor: byte; OrSrc,
OrDest: TDIBOrientation );
procedure DrawCircle( pDest: pointer; x, y, nRadius, nDestWidth, nDestHeight: integer;
nColor: byte );
procedure DrawDIB( pSrc, pDest: pointer; nSrcWidth, nSrcHeight, nDestWidth,
nDestX, nDestY: integer; nTrans: byte; nOrientation: byte ); stdcall; assembler;
procedure DrawLine( p: pointer; x1, y1, x2, y2, nDestWidth: integer; nColor: byte ); stdcall; assembler;
procedure DrawLineThick( p: pointer; x1, y1, x2, y2, nDestWidth, nDestHeight: integer;
nColor, nThickness: byte );
procedure DumpDIB( pSrc, pDest: pointer; nSrcWidth, nSrcHeight: integer;
nOrientation: byte ); stdcall; assembler;
procedure FillBlock( pDest: pointer; nBlockWidth, nBlockHeight,
nDestWidth, nDestHeight, nDestX, nDestY: integer;
nColor: byte; OrDest: TDIBOrientation );
procedure FillMem( p: pointer; nBytes: integer; nVal: byte ); stdcall; assembler;
function PointInPolygon( poly: TPolygon; pt: TPoint ): boolean;
function IntToDegree( n: integer ): TDegree;
(***************************************************
The following arrays are lookup tables of common
trig functions.
***************************************************)
var
lkupSin: array[TDegree] of single;
lkupCos: array[TDegree] of single;
lkupArcTan: array[TDegree] of single;